package com.jorado.trace;

import java.util.Random;

final class Jre6Platform extends Platform.Jre6 {

    private final Random prng;

    Jre6Platform(Random prng) {
        if (prng == null) {
            throw new NullPointerException("Null prng");
        }
        this.prng = prng;
    }

    @Override
    Random prng() {
        return prng;
    }

    @Override
    public String toString() {
        return "Jre6{" + "prng=" + prng + "}";
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (o instanceof Platform.Jre6) {
            Platform.Jre6 that = (Platform.Jre6) o;
            return (this.prng.equals(that.prng()));
        }
        return false;
    }

    @Override
    public int hashCode() {
        int h = 1;
        h *= 1000003;
        h ^= this.prng.hashCode();
        return h;
    }
}
